<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flow Time - 专注时间管理</title>
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
    <div class="app-wrapper">
        <!-- 顶部导航栏 -->
        <header class="header">
            <div class="header-content">
                <div class="logo">
                    <i class="fas fa-stream"></i>
                    <span>Flow Time</span>
                </div>
                <nav class="main-nav">
                    <button class="nav-btn active" data-view="focus">专注模式</button>
                    <button class="nav-btn" data-view="tasks">任务管理</button>
                    <button class="nav-btn" data-view="stats">统计分析</button>
                </nav>
                <div class="header-actions">
                    <button class="icon-btn" id="themeToggle">
                        <i class="fas fa-moon"></i>
                    </button>
                    <button class="icon-btn" id="settingsBtn">
                        <i class="fas fa-cog"></i>
                    </button>
                </div>
            </div>
        </header>

        <!-- 主要内容区域 -->
        <main class="main-container">
            <!-- 专注模式视图 -->
            <div class="view active" id="focusView">
                <div class="focus-grid">
                    <!-- 计时器卡片 -->
                    <div class="card timer-card">
                        <div class="timer-display">
                            <div class="timer-progress">
                                <svg class="progress-ring" width="300" height="300">
                                    <circle class="progress-ring-circle" cx="150" cy="150" r="140"/>
                                </svg>
                                <div class="timer-content">
                                    <div class="time" id="timerDisplay">25:00</div>
                                    <div class="label" id="timerLabel">专注时间</div>
                                </div>
                            </div>
                            <div class="timer-controls">
                                <button class="control-btn" id="resetTimer">
                                    <i class="fas fa-redo-alt"></i>
                                </button>
                                <button class="control-btn primary" id="startTimer">
                                    <i class="fas fa-play"></i>
                                </button>
                                <button class="control-btn" id="skipTimer">
                                    <i class="fas fa-forward"></i>
                                </button>
                            </div>
                        </div>
                    </div>

                    <!-- 当前任务卡片 -->
                    <div class="card current-task-card">
                        <h2>当前任务</h2>
                        <div class="current-task" id="currentTask">
                            <p class="empty-task">选择一个任务开始专注</p>
                        </div>
                        <div class="task-quick-add">
                            <input type="text" placeholder="快速添加任务..." id="quickAddTask">
                            <button class="icon-btn" id="quickAddBtn">
                                <i class="fas fa-plus"></i>
                            </button>
                        </div>
                    </div>

                    <!-- 白噪音控制卡片 -->
                    <div class="card sounds-card">
                        <h2>环境音效</h2>
                        <div class="sound-mixer">
                            <div class="sound-item" data-sound="rain">
                                <button class="sound-btn">
                                    <i class="fas fa-cloud-rain"></i>
                                </button>
                                <div class="sound-control">
                                    <span>雨声</span>
                                    <input type="range" class="volume-slider" min="0" max="100" value="50">
                                </div>
                            </div>
                            <div class="sound-item" data-sound="waves">
                                <button class="sound-btn">
                                    <i class="fas fa-water"></i>
                                </button>
                                <div class="sound-control">
                                    <span>海浪</span>
                                    <input type="range" class="volume-slider" min="0" max="100" value="50">
                                </div>
                            </div>
                            <div class="sound-item" data-sound="cafe">
                                <button class="sound-btn">
                                    <i class="fas fa-coffee"></i>
                                </button>
                                <div class="sound-control">
                                    <span>咖啡厅</span>
                                    <input type="range" class="volume-slider" min="0" max="100" value="50">
                                </div>
                            </div>
                            <div class="sound-item" data-sound="fire">
                                <button class="sound-btn">
                                    <i class="fas fa-fire"></i>
                                </button>
                                <div class="sound-control">
                                    <span>篝火</span>
                                    <input type="range" class="volume-slider" min="0" max="100" value="50">
                                </div>
                            </div>
                        </div>
                    </div>

                    <!-- 今日进度卡片 -->
                    <div class="card progress-card">
                        <h2>今日进度</h2>
                        <div class="stats-grid">
                            <div class="stat-item">
                                <div class="stat-value" id="todayPomodoros">0</div>
                                <div class="stat-label">完成番茄数</div>
                            </div>
                            <div class="stat-item">
                                <div class="stat-value" id="todayFocusTime">0分钟</div>
                                <div class="stat-label">专注时长</div>
                            </div>
                            <div class="stat-item">
                                <div class="stat-value" id="todayTasks">0/0</div>
                                <div class="stat-label">任务完成</div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 任务管理视图 -->
            <div class="view" id="tasksView">
                <div class="tasks-header">
                    <div class="tasks-filters">
                        <button class="filter-btn active" data-filter="all">全部任务</button>
                        <button class="filter-btn" data-filter="today">今日任务</button>
                        <button class="filter-btn" data-filter="upcoming">即将到期</button>
                        <button class="filter-btn" data-filter="completed">已完成</button>
                    </div>
                    <button class="primary-btn" id="addTaskBtn">
                        <i class="fas fa-plus"></i> 新建任务
                    </button>
                </div>
                <div class="tasks-grid" id="tasksGrid">
                    <!-- 任务列表将通过 JavaScript 动态添加 -->
                </div>
            </div>

            <!-- 统计分析视图 -->
            <div class="view" id="statsView">
                <div class="stats-header">
                    <h2>专注记录</h2>
                    <div class="date-range">
                        <button class="range-btn active" data-range="week">本周</button>
                        <button class="range-btn" data-range="month">本月</button>
                        <button class="range-btn" data-range="year">全年</button>
                    </div>
                </div>
                <div class="stats-container">
                    <div class="card">
                        <canvas id="focusChart"></canvas>
                    </div>
                    <div class="stats-summary">
                        <div class="summary-card">
                            <h3>专注时间</h3>
                            <div class="summary-value" id="totalFocusTime">0小时</div>
                            <div class="summary-change positive">+5% 相比上周</div>
                        </div>
                        <div class="summary-card">
                            <h3>完成任务</h3>
                            <div class="summary-value" id="totalTasks">0个</div>
                            <div class="summary-change positive">+3 相比上周</div>
                        </div>
                        <div class="summary-card">
                            <h3>平均专注时长</h3>
                            <div class="summary-value" id="avgFocusTime">0分钟</div>
                            <div class="summary-change negative">-2分钟 相比上周</div>
                        </div>
                    </div>
                </div>
            </div>
        </main>

        <!-- 浮动播放器 -->
        <div class="floating-player" id="floatingPlayer">
            <div class="player-time">
                <i class="fas fa-clock"></i>
                <span id="floatingTime">25:00</span>
            </div>
            <div class="player-controls">
                <button class="player-btn" id="floatingPlayPause">
                    <i class="fas fa-play"></i>
                </button>
            </div>
            <div class="player-sounds">
                <i class="fas fa-volume-up"></i>
                <span id="activeSoundsCount">0</span>
            </div>
        </div>
    </div>

    <!-- 任务编辑对话框 -->
    <div class="modal" id="taskModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3>新建任务</h3>
                <button class="close-btn">&times;</button>
            </div>
            <div class="modal-body">
                <form id="taskForm">
                    <div class="form-group">
                        <label for="taskTitle">任务名称</label>
                        <input type="text" id="taskTitle" required>
                    </div>
                    <div class="form-row">
                        <div class="form-group">
                            <label for="taskPomodoros">预计番茄数</label>
                            <input type="number" id="taskPomodoros" min="1" value="1">
                        </div>
                        <div class="form-group">
                            <label for="taskPriority">优先级</label>
                            <select id="taskPriority">
                                <option value="low">低</option>
                                <option value="medium" selected>中</option>
                                <option value="high">高</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-row">
                        <div class="form-group">
                            <label for="taskDate">截止日期</label>
                            <input type="date" id="taskDate">
                        </div>
                        <div class="form-group">
                            <label for="taskTags">标签</label>
                            <input type="text" id="taskTags" placeholder="用逗号分隔">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="taskNotes">备注</label>
                        <textarea id="taskNotes" rows="3"></textarea>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button class="secondary-btn close-btn">取消</button>
                <button class="primary-btn" id="saveTaskBtn">保存</button>
            </div>
        </div>
    </div>

    <!-- 设置对话框 -->
    <div class="modal" id="settingsModal">
        <div class="modal-content">
            <div class="modal-header">
                <h3>设置</h3>
                <button class="close-btn">&times;</button>
            </div>
            <div class="modal-body">
                <div class="settings-section">
                    <h4>时间设置</h4>
                    <div class="form-group">
                        <label for="workDuration">工作时长（分钟）</label>
                        <input type="number" id="workDuration" value="25" min="1">
                    </div>
                    <div class="form-group">
                        <label for="breakDuration">休息时长（分钟）</label>
                        <input type="number" id="breakDuration" value="5" min="1">
                    </div>
                </div>
                <div class="settings-section">
                    <h4>通知设置</h4>
                    <div class="form-group">
                        <label class="checkbox-label">
                            <input type="checkbox" id="soundNotification" checked>
                            声音提醒
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="checkbox-label">
                            <input type="checkbox" id="desktopNotification" checked>
                            桌面通知
                        </label>
                    </div>
                </div>
                <div class="settings-section">
                    <h4>自动化</h4>
                    <div class="form-group">
                        <label class="checkbox-label">
                            <input type="checkbox" id="autoStartBreak">
                            自动开始休息
                        </label>
                    </div>
                    <div class="form-group">
                        <label class="checkbox-label">
                            <input type="checkbox" id="autoStartWork">
                            自动开始下一个工作时段
                        </label>
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <button class="secondary-btn close-btn">取消</button>
                <button class="primary-btn" id="saveSettingsBtn">保存</button>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    <script src="js/main.js" type="module"></script>
</body>
</html>
